package com.retry.task.admin.infrastructure.task;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.Executor;

/**
 * @author gao.gwq
 * @version 1.0
 * @date 2022/10/16  21:02
 * @Description TODO
 */
public abstract class AbstractPerpetualTask implements ITask {

    private final Logger LOGGER = LoggerFactory.getLogger(getClass().getName());

    /**
     * 初始化delay
     */
    private Long initDelay;

    /**
     * 时间间隔
     */
    private Long interval;


    private Long nextExecuteTime;


    private Long currentExecuteTime;

    public Long getFirstExecuteTime() {
        return System.currentTimeMillis() + initDelay * 1000;
    }


    public Long getNextExecuteTime() {
        return currentExecuteTime + interval * 1000;
    }

}